<form [formGroup]="formModel" (ngSubmit) = "onSubmit()" novalidate>
  <div class="form-group" [class.has-error]="formModel.hasError('minlength','title')">
    <label for="productTitle">商品名称：</label>
    <input type="text" formControlName="title" id="productTitle"  class="form-control" placeholder="商品名称">
    <span class="help-block" *ngIf="formModel.hasError('minlength','title')">请至少输入三个字符</span>
  </div>
  <div class="form-group" [class.has-error]="formModel.hasError('positiveNumber','price')">
    <label for="productPrice">商品价格</label>
    <input type="text" formControlName="price" id="productPrice" name="productPrice" class="form-control" placeholder="商品价格">
    <span class="help-block" *ngIf="formModel.hasError('positiveNumber','title')">请输入正数</span>
  </div>
  <div class="form-group">
    <label for="productCategroy">商品类别</label>
    <select formControlName="categroy" class="form-control" id="categroy">
      <option value="-1">--全部分类--</option>
      <option [value]="item" *ngFor="let item of categroies">{{item}}</option>
    </select>
  </div>
  <div class="form-group">
    <button type="submit" class="btn btn-primary btn-block">
      搜索
    </button>
  </div>
</form>
